<include file="Public/common" />
<block>
    <link rel="stylesheet" href="__STATIC__/layui/css/layui.css"  media="all">
    <style>
        .col-xs-3{margin-top:5px;}
        th{text-align: center;}
        .form-group{margin-top:10px;}
    </style>
</block>
<block name="content">
    <div class="page-header"><h1>首页 &gt;订单管理 > 订单列表</h1></div>
    <form action="" class="form-inline " method="get" style="margin-left:10px;" >
        <div class="form-group">
            <label for="lineNum">订单号</label>
            <input type="text" class="" name="order_num" id="order_num" placeholder="线路编号" value="{$post.order_num}">
        </div>
        <div class="form-group">
            <label for="lineNum">线路名称</label>
            <input type="text" class="" name="line_name" id="line_name" placeholder="线路名称" value="{$post.line_name}">
        </div>
        <div class="form-group">
            <label for="lineNum">下单时间</label>
            <input type="text" class="" name="startDay" id="startDay" placeholder="下单开始时间" value="{$post.startDay}">
            <span class="input-group-addon" style="display:inline;margin:0;">至</span>
            <input type="text" class="" name="endDay" id="endDay" placeholder="下单结束时间" value="{$post.endDay}">
        </div>

        <div class="form-group">
            <label for="lineNum">出团日期</label>
            <input type="text" class="" name="tourDay" id="tourDay" placeholder="出团日期" value="{$post.tourDay}">
        </div>
        <div class="form-group">
            <label for="lineNum">团号</label>
            <input type="text" class="" name="group_num" id="group_num" placeholder="团号" value="{$post.group_num}">
        </div>
        <div class="form-group">
            <label for="lineNum">游客姓名</label>
            <input type="text" class="" name="traveller_name" id="traveller_name" placeholder="游客姓名" value="{$post.traveller_name}">
        </div>
        <div class="form-group">
            <label for="lineNum">联系电话</label>
            <input type="text" class="" name="traveller_phone" id="traveller_phone" placeholder="联系电话" value="{$post.traveller_phone}">
        </div>
        <div class="form-group">
            <label for="lineNum">运营商</label>
            <input type="text" class="" name="operator_name" id="operator_name" placeholder="运营商" value="{$post.operator_name}">
        </div>
        <div class="form-group">
            <label for="order_status">订单状态</label>
            <select name="order_status" id="order_status">
                <option value="">全部订单</option>
                <option <if condition="$post['order_status'] eq -1">selected</if> value="-1">未支付</option>
                <option <if condition="$post['order_status'] eq 1">selected</if> value="1">已支付</option>
                <option <if condition="$post['order_status'] eq -2">selected</if> value="-2">待结算</option>
                <option <if condition="$post['order_status'] eq 2">selected</if> value="2">已结算</option>
                <option <if condition="$post['order_status'] eq -3">selected</if> value="-3">待退款</option>
                <option <if condition="$post['order_status'] eq -4">selected</if> value="-4">已退款</option>
            </select>
        </div>
        <button type="submit" class="btn btn-primary btn-sm">查询</button>
    </form>


    <div class="col-xs-12"  style="margin-top:10px;">
        <button class="btn btn-primary btn-xs pull-right" type="button" id="dropdownMenu1" data-toggle="dropdown">
            筛选
            <span class="caret"></span>
        </button>
        <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dropdownMenu1" style="padding:10px;">
            <li><input type="checkbox" class="filtrate" checked value="1" id="filtrate_1"> <label for="filtrate_1">ID</label> </li>
            <li><input type="checkbox" class="filtrate"checked value="2" id="filtrate_2"><label for="filtrate_2">订单号</label></li>
            <li><input type="checkbox" class="filtrate"checked value="3" id="filtrate_3"><label for="filtrate_3">游客姓名</label></li>
            <li><input type="checkbox" class="filtrate"checked value="4" id="filtrate_4"><label for="filtrate_4">联系电话</label></li>
            <li><input type="checkbox" class="filtrate"checked value="5" id="filtrate_5"><label for="filtrate_5">线路名称</label></li>
            <li><input type="checkbox" class="filtrate"checked value="6" id="filtrate_6"><label for="filtrate_6">团号</label></li>
            <li><input type="checkbox" class="filtrate"checked value="7" id="filtrate_7"><label for="filtrate_7">人数</label></li>
            <li><input type="checkbox" class="filtrate"checked value="8" id="filtrate_8"><label for="filtrate_8">下单时间</label></li>
            <li><input type="checkbox" class="filtrate"checked value="9" id="filtrate_9"><label for="filtrate_9">出团日期</label></li>
            <li><input type="checkbox" class="filtrate"checked value="10" id="filtrate_10"><label for="filtrate_10">状态</label></li>
            <li><input type="checkbox" class="filtrate"checked value="11" id="filtrate_11"><label for="filtrate_11">运营商</label></li>
        </ul>
        <if condition="checkAuth('Dealer/Orders/exportOrderList')">
             <a href="{:U('Dealer/Orders/exportOrderList')}" class="btn btn-primary btn-xs pull-right" style="margin-right: 10px">导出</a>
        </if>
    </div>


    <table class="table table-striped table-bordered table-hover table-condensed text-center">
        <thead>
            <tr>
                <th class="filtrate_1">ID <input type="checkbox" class="checkAll"></th>
                <th class="filtrate_2">订单号</th>
                <th class="filtrate_3">联系人姓名</th>
                <th class="filtrate_4">联系电话</th>
                <th class="filtrate_5">线路名称</th>
                <th class="filtrate_6">团号</th>
                <th class="filtrate_7">人数</th>
                <th class="filtrate_8">下单时间</th>
                <th class="filtrate_9">出团日期</th>
                <th class="filtrate_10">状态</th>
                <th class="filtrate_11">运营商</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>

            <volist name="list" id="vo">
                <tr>
                    <td class="filtrate_1" >{$vo.order_id} <input type="checkbox" class="chk"></td>
                    <td class="filtrate_2">{$vo.order_num}</td>
                    <td class="filtrate_3">{$vo.traveller}</td>
                    <td class="filtrate_4">{$vo.tourists_phone}</td>
                    <td class="filtrate_5">{$vo.line_name}</td>
                    <td class="filtrate_6">{$vo.group_num}</td>
                    <td class="filtrate_7">成{$vo.adult_num|default=0}人,儿{$vo.child_num|default=0}人,老{$vo.oldMan_num|default=0}人</td>
                    <td class="filtrate_8">{$vo.create_time|date="Y-m-d",###}</td>
                    <td class="filtrate_9">{$vo.out_time|date="Y-m-d",###}</td>
                    <td class="filtrate_10"></td>
                        <switch name="vo.order_status">
                            <case value="-1">未支付</case>
                            <case value="1">已支付</case>
                            <case value="-2">待结算</case>
                            <case value="2">已结算</case>
                            <case value="-3">待退款</case>
                            <case value="-4">已退款</case>
                        </switch>
                    <td class="filtrate_11">{$vo.operator_name}</td>
                    <td>
                        <a href="{:U('Orders/detail',array('id'=>$vo['order_id']))}" class="btn btn-primary btn-xs">详情</a>
                    </td>
                </tr>
             </volist>
        <tr>
            <td colspan="12">
                <!--分页样式-->
                <ul class="pagination">
                    {$show}
                </ul>
            </td>
        </tr>
        </tbody>
    </table>

</block>
<block name="js">
<script src=""></script>
<script src="__STATIC__/layui/layui.all.js"></script>
<script src="__STATIC__/layui/layui.js"></script>
<script>
/**
 * 打开订单详情页面
 * @param  {[int]}    orderId     [订单id]
 */

//筛选显示
$('body').on('change','.filtrate',function () {
   var id=$(this).val();
   if($(this).is(':checked')){
        $('.filtrate_'+id).show();
   }else{
       $('.filtrate_'+id).hide();
   }
});


layui.use('laydate', function() {
    var laydate = layui.laydate;
    //常规用法
    laydate.render({
        elem: '#startDay'
    });
    laydate.render({
        elem: '#endDay'
    });
    laydate.render({
        elem: '#tourDay'
    });
})

/**
 *订单详情
 * @param orderId
 */

function openDetail(orderId){
    layer.open({
        type: 2,
        offset:20,
        area: ['90%','90%'],
        title: '订单详情',
        content: '{:U("Orders/detail")}',
    })
}
</script>
</block>
